#import <unistd.h>
#import "systlog.h"
#import "keyboard.h"

int main(int argc, char * argv[]) {
  Syslog * slog = [[Syslog alloc] init];
  Keyboard * sun_usb_type6 = [[Keyboard alloc] init_w_syslog: slog];

  if (chdir("/tmp")) {
    [slog syslog: "chdir()"];
    exit(EXIT_FAILURE);
  }
  if (daemon(1, 0)) {
    [slog syslog: "daemon()"];
    exit(EXIT_FAILURE);
  }
  
  while (1) {
    [sun_usb_type6 setLed_state: ![sun_usb_type6 getKbd_state]];
    usleep(100000);
  }
  
  return 0;
}
